;子程序名：WORK6
;功能：完成主菜单功能六，根据登录状态修改商品信息
;入口参数：AUTH--决定登录状态
;出口参数：AX--待转换数
;所用寄存器：DI--当前商品的地址，SI--十进制指针
;调用子程序名：F2T10

NAME WORK6
PUBLIC WORK6
EXTRN F2T10:NEAR
EXTRN F10t2:NEAR
EXTRN ACTUAL:BYTE
EXTRN CRLF:BYTE
EXTRN AUTH:BYTE

.386
DATA  SEGMENT  USE16  PUBLIC  'DATA'
      WORKNEW1 DB  'WRONG$',0
      WORKNEW2 DB  'PURCHASE PRICE:$',0
      WORKNEW3 DB  'DISCOUNT:$'.0
      WORKNEW4 DB  'SELL PRICE:$',0
      WORKNEW5 DB  'TOTAL NUMBER:$',0
      IN_NUM   DB  6,?,6DUP(0);用于存储修改信息
      KEY      DB  0
DATA ENDS

STACK SEGMENT  USE16  STACK  'STACK'
      DB  200  DUP(0)
STACK ENDS

CODE SEGMENT USE16 PUBLIC  'CODE'
     ASSUME  CS:CODE,DS:DATA,SS:STACK
WORK6 PROC
      PUSH DI
      PUSH SI
      LEA  DX,CRLF
      MOV  AH,9
      INT  21H
      MOV  AL,AUTH
      CMP  AL,0
      JZ   BACK6
      CMP  BP,0
      JZ   BACK6
      MOV  DI,BP
      MOV  KEY,0
      
      LEA  DX,WORKNEW3
      MOV  AH,9
      INT  21H
      MOV  AL,BYTE PTR[DI+10]
      CBW
      CALL F2T10
      MOV  AH,1
      INT  21H
      CMP  AL,'>'
      MOV  KEY,1
      JZ   PASS

W1:
      LEA DX,WORKNEW2
      MOV AH,9
      INT 21H
      MOV AX,[DI+11]
      CALL F2T10
      MOV AH,1
      INT 21H
      CMP AL,'>'
      MOV KEY,2
      JZ PASS

W2:
      LEA DX,WORKNEW4
      MOV AH,9
      INT 21H
      MOV AX,[DI+13]
      CALL F2T10
      MOV AH,1
      INT 21H
      CMP AL,'>'
      MOV KEY,3
      JZ  PASS

W3:
      LEA DX,WORKNEW5
      MOV AH,9
      INT 21H
      MOV AX,[DI+15]
      CALL F2T10
      MOV AH,1
      INT 21H
      CMP AL,'>'
      MOV KEY,4
      JZ PASS

PASS:
      LEA DX,IN_NUM
      MOV AH,10
      INT 21H
      MOV SI,DI
      MOV CL,BYTE PTR[IN_NUM+1]
      MOV CH,0
      MOV SI,OFFSET IN_NUM
      ADD SI,2
      CMP BYTE PTR[IN_NUM+2],0DH
      JZ  MORE
      CALL F10T2
      CMP SI,-1
      JZ BACK6
      CMP KEY 0
      JZ BACK6
      CMP KEY,1
      JZ WR1
      CMP KEY,2
      JZ WR2
      CMP KEY,3
      JZ WR3
      CMP KEY,4
      JZ BACK6

MORE:
      CMP KEY,0
      JZ BACK6
      CMP KEY,1
      JZ WOR1
      CMP KEY,2
      JZ WOR2
      CMP KEY3
      JZ WOR3
      CMP KEY,4
      JZ WOR4
      JMP BACK6

WR1:
      MOV BYTE PTR[DI+10],AL
WOR1:
      LEA DX,CRLF
      MOV AH,9
      INT 21H
      JMP W1
WR2:
      MOV [DI+11],AX
WOR2:
      LEA DX,CRLF
      MOV AH,9
      INT 21H
      JMP W2
WR3:
      MOV [DI+13],AX
WOR3:
      LEA DX,CRLF
      MOV AH,9
      INT 21H
      JMP W3
WR4:
      MOV [DI+15],AX
WOR4:
      LEA DX,CRLF
      MOV AH,9
      INT 21H
      JMP HUISU
BACK6:
      LEA DX,CRLF
      MOV AH,9
      INT 21H
      LEA DX,WORKNEW1
      MOV AH,9
      INT 21H
      LEA DX,CRLF
      MOV AH,9
      INT 21H
      JMP HUISU
HUISU:
      POP SI
      POP DI
      RET
WORK6 ENDP
CODE ENDS
     END